package com.yisu.expressway.ewf.common.rong;

import com.yisu.expressway.ewf.common.rong.models.TokenResult;
import com.yisu.expressway.ewf.common.rong.request.UserTokenRequest;

/**
 * Created by nichole on 2017/4/7.
 */
public class RongCloudHelper {

    public static String getUserToken(UserTokenRequest request) {
        try {
            RongCloud rongCloud = RongCloud.getInstance(request.getAppKey(), request.getAppSecret());
            TokenResult userGetTokenResult = rongCloud.user.getToken(request.getUserId(), request.getUserName(), request.getUserAvatar());
            return userGetTokenResult.getToken();
        } catch (Exception e) {
            return null;
        }
    }
}
